from django.db import models

# Create your models here.


class Org_Department(models.Model):
	KeyId = models.CharField(max_length=36)
	ParentKeyId = models.CharField(max_length=36)
	DepartmentName = models.CharField(max_length=32)
	DepartmentNo = models.CharField(max_length=32)
	Level = models.SmallIntegerField()
	CreateTime = models.DateTimeField(primary_key=True)
	UpdateTime = models.DateTimeField()
	CreateUserKeyId = models.CharField(max_length=36)
	UpdateUserKeyId = models.CharField(max_length=36)
	Version = models.IntegerField()
	IsDelete = models.SmallIntegerField()

	class Meta:
		db_table='Org_Department'


class Org_User(models.Model):
	KeyId = models.CharField(max_length=36)
	UserName = models.CharField(max_length=32)
	Password = models.CharField(max_length=32)
	CreateTime = models.DateTimeField(primary_key=True,auto_now_add=True)
	UpdateTime = models.DateTimeField(auto_now=True)
	CreateUserKeyId = models.CharField(max_length=36)
	UpdateUserKeyId = models.CharField(max_length=36)
	VaildTime = models.DateTimeField(null=True,auto_now_add=True)
	Version = models.IntegerField()
	IsDelete = models.SmallIntegerField()

	class Meta:
		db_table='Org_User'


class Org_Employee(models.Model):
	KeyId = models.CharField(max_length=36)
	EmployeeNo = models.CharField(primary_key=True, max_length=11)
	EmployeeName = models.CharField(max_length=12)
	UserKeyId = models.CharField(max_length=36)
	Mobile = models.CharField(max_length=11)
	Email = models.CharField(max_length=50)
	CreateUserKeyId = models.CharField(max_length=36)
	CreateTime = models.DateTimeField(auto_now_add=True)
	UpdateUserKeyId = models.CharField(max_length=36)
	UpdateTime = models.DateTimeField(auto_now=True)
	Version = models.IntegerField()
	IsDelete = models.IntegerField()

	class Meta:
		db_table='Org_Employee'

class Org_UserDeptRoleRelations(models.Model):
	KeyId = models.CharField(max_length=36)
	UserKeyId = models.CharField(max_length=36)
	EmployeeKeyId = models.CharField(max_length=36)
	DepartmentKeyId = models.CharField(max_length=36)
	RoleKeyId = models.CharField(max_length=36, null=True)
	CreateTime = models.DateTimeField(primary_key=True, auto_now_add=True)

	class Meta:
		db_table='Org_UserDeptRoleRelations'
		

class Org_Role(models.Model):
	KeyId = models.CharField(max_length=36)
	RoleName = models.CharField(max_length=32)
	RoleCode = models.CharField(max_length=12)
	RoleType = models.SmallIntegerField()
	static = models.SmallIntegerField()
	CreateTime = models.DateTimeField(primary_key=True)
	CreateUserKeyId = models.CharField(max_length=36)
	UpdateTime = models.DateTimeField()
	UpdateUserKeyId  = models.CharField(max_length=36)
	Version = models.IntegerField()
	IsDelete = models.SmallIntegerField()

	class Meta:
		db_table='Org_Role'


		